#ifndef LAYOUTWIDGHET_H
#define LAYOUTWIDGHET_H

#include <QWidget>
#include <QStyle>
#include <QStyleOption>

#include "common.h"
#include "qpainter.h"
#include "itemwidget.h"
#include "../basewidgets/basewidget.h"
#include "observer/globalobserver.h"

struct ItemShowData
{
    CabPosItem cab_pos_item_data;
    ItemWidget *item_widget;
};

class LayoutWidget : public BaseShowWidget
{
    Q_OBJECT
public:
    explicit LayoutWidget(Layout layout, int screen_id, int partition_id, BaseShowWidget *parent = 0);
    void setAllChildrenLossSelect();
    void setSelectStyle(bool select);
    void selectChild(int item_id, QString cab_pos_item_str);
    inline int getLayoutId() {return m_layout.id;}
    void delItem(int item_id);
    void addItem(Item add_item);
    void delCabPos(int item_id, QString cab_pos_item_str);
    void addCabPos(int item_id, CabPosItem add_cabpositem, QString cab_pos_item_str = "cab[*]-position[*]");
    void updateLayout(Layout layout);

private:
    Layout m_layout;
    int m_screen_id;
    int m_partition_id;
    QMap<QString, ItemShowData> m_items_data;
};

#endif // LAYOUTWIDGHET_H
